//
//  ConfirmShopingListViewController.m
//  DA_V
//
//  Created by 中亿世联前台 on 15/4/22.
//  Copyright (c) 2015年 zhouhai. All rights reserved.
//

#import "ConfirmShopingListViewController.h"
#import "ShoppingListAddressView.h"
#import "ShoppingImageView.h"
#import "ShoppingImageScrollView.h"
#import "UIViewAdditions.h"
#import "NewButton.h"
#import "InterFace.h"

@interface ConfirmShopingListViewController ()
@property (nonatomic, strong) ShoppingListAddressView *addressView;
@property (nonatomic, strong) ShoppingImageScrollView *shoppingScrollView;
@property (nonatomic, strong) UIScrollView *mainScrollView;
@end

@implementation ConfirmShopingListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
  
    self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    if (SCREEN_HEIGHT < 568) {
        self.mainScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT*1.2);
    }

      [self createSubViews];
    [self.view addSubview:self.mainScrollView];
}


#

#pragma -mark 添加地址View

- (void)creareAddressView{
    
    self.addressView = [[[NSBundle mainBundle] loadNibNamed:@"Shopping_Cart_Xib" owner:self options:nil] objectAtIndex:3];
    _addressView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 100);
    self.addressView.backgroundColor = [UIColor greenColor];
    [self.mainScrollView addSubview:_addressView];
    
}

#pragma -mark 创建商品滑动图片
- (void)createShoppingScrollViewImage{
    CGRect rect = CGRectMake(0, self.addressView.bottom , SCREEN_WIDTH, 100);
    self.shoppingScrollView = [ShoppingImageScrollView  soppingImageScrollViewWithFrame:rect data:nil];
    self.shoppingScrollView.backgroundColor = [UIColor blueColor];
    self.shoppingScrollView.contentSize = CGSizeMake(SCREEN_WIDTH*2, 100);
    [self.mainScrollView addSubview:_shoppingScrollView];
    
}


#pragma -mark 创建self.view子视图

- (void)createSubViews{
    
    [self creareAddressView];
    [self createShoppingScrollViewImage];
    [self individualManUI_View];

}

#pragma -mark 创建展示UI
- (void)individualManUI_View{
    //总价格
    UILabel *allPrace = [[UILabel alloc]initWithFrame:CGRectMake(self.addressView.frame.origin.x, self.shoppingScrollView.bottom+10, 100, 30)];
    allPrace.text = @"总金额: 186";
    [self.mainScrollView addSubview:allPrace];
    
//    //货到付款
    NewButton *consigneeBut = [[NewButton alloc]initWithFrame:CGRectMake((SCREEN_WIDTH-100-40) / 2-20, allPrace.bottom + 15, 50, 40)];
    
    
//    [okBut setTitle:@"确认" forState:UIControlStateNormal];
//    [okBut addTarget:self action:@selector(okbutclick:) forControlEvents:UIControlEventTouchUpInside];
//    okBut.backgroundColor = [UIColor greenColor];
    [self.mainScrollView addSubview:consigneeBut];
    
//    //在线支付
    NewButton *zhifu = [[NewButton alloc]initWithFrame:CGRectMake(consigneeBut.right +80, allPrace.bottom + 15, 50, 40)];
    [self.mainScrollView addSubview:zhifu];
    
    //全部
    NewButton *allbut = [[NewButton alloc]initWithFrame:CGRectMake((SCREEN_WIDTH-150-80) / 3.0, zhifu.bottom + 35, 50, 40)];
    [self.mainScrollView addSubview:allbut];

    //周末
    NewButton *weekendBut = [[NewButton alloc]initWithFrame:CGRectMake(allbut.right+55, zhifu.bottom + 35, 50, 40)];
    [self.mainScrollView addSubview:weekendBut];
    
    //工作日
    //周末
    NewButton *workdayBut = [[NewButton alloc]initWithFrame:CGRectMake(weekendBut.right+55, zhifu.bottom + 35, 50, 40)];
    [self.mainScrollView addSubview:workdayBut];
    
    //确认
    UIButton *okBut = [[UIButton alloc]initWithFrame:CGRectMake((SCREEN_WIDTH-160-40) / 2, workdayBut.bottom + 35, 80, 40)];
    [okBut setTitle:@"确认" forState:UIControlStateNormal];
    [okBut addTarget:self action:@selector(okbutclick:) forControlEvents:UIControlEventTouchUpInside];
    okBut.backgroundColor = [UIColor greenColor];
    [self.mainScrollView addSubview:okBut];
    
    //返回选购
    UIButton *backBut = [[UIButton alloc]initWithFrame:CGRectMake(okBut.right +40, workdayBut.bottom + 35, 80, 40)];
    [backBut setTitle:@"返回选购" forState:UIControlStateNormal];
    backBut.backgroundColor = [UIColor greenColor];
    [self.mainScrollView addSubview:backBut];
}

#pragma -mark 点击确认按钮事件
- (void)okbutclick:(id)sender{
    
}

@end
